/**
 * Copyright (C), 2015-2022, XXX有限公司
 * <p>
 * FileName: CommonMetaObjectHandler
 * <p>
 * Author: 12044
 * <p>
 * Date: 2022/1/19 16:27
 * <p>
 * Description:
 * <p>
 * History:
 *
 * <author> <time> <version> <desc>
 * <p>
 * 作者姓名 修改时间 版本号 描述
 */


package com.atguigu.yygh.common.handler;


import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Mybatis plus Handler配置类<br>
 * 〈〉
 *
 * @author 12044

 * @create 2022/1/19

 * @since 1.0.0

 */
@Component
public class CommonMetaObjectHandler implements MetaObjectHandler {


    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("createTime", new Date(), metaObject);
        this.setFieldValByName("updateTime", new Date(), metaObject);
    }
    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("updateTime", new Date(), metaObject);
    }
}
